package cn.ywsj.ywsjmidtier.controller;

import cn.ywsj.ywsjmidtier.entity.VO.ApplicationQueryVo;
import cn.ywsj.ywsjmidtier.entity.VO.ApplicationVo;
import cn.ywsj.ywsjmidtier.entity.VO.ThOrderDetailQueryVo;
import cn.ywsj.ywsjmidtier.service.WechatAppPayFeign;
import cn.ywsj.ywsjmidtier.service.WechatApplicationFeign;
import cn.ywsj.ywsjmidtier.utils.JsonObjectUtil;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "资金管理")
@RestController
@RequestMapping("/wechat/member/applicationmgr")
public class WechatApplicationController {

    @Autowired
    private WechatApplicationFeign applicationFeign;

    /**
     * 资金管理_列表
     * @param start
     * @param pageSize
     * @param type
     * @return
     */
    @ApiOperation("资金管理_列表")
    @PostMapping("/expenditureincomelist")
    public String expenditureIncomeList(Integer start,Integer pageSize,Integer type) {
        return applicationFeign.expenditureIncomeList(start,pageSize,type);
    }

    /**
     * 资金管理_金额
     * @return
     */
    @ApiOperation("资金管理_金额")
    @PostMapping("/getamountbycust")
    public String getAmountByCust() {
        return applicationFeign.getAmountByCust();
    }
    @PostMapping("/ajaxapplicationlist")
    public String getRebatesFeePage(ThOrderDetailQueryVo thOrderDetailQueryVo){
        JSONObject jsonObject = JsonObjectUtil.ObjectToJson(thOrderDetailQueryVo);
        return applicationFeign.getRebatesFeePage(jsonObject);
    }
    @PostMapping("/applicationlistwithdrawal")
    public String applicationListWithdrawal(ApplicationQueryVo applicationQueryVo){
        JSONObject jsonObject = JsonObjectUtil.ObjectToJson(applicationQueryVo);
        return applicationFeign.applicationListWithdrawal(jsonObject);
    }
    @PostMapping("/addwithdrawal")
    public String addWithdrawal(ApplicationVo applicationVo, BindingResult result){
        JSONObject jsonObject = JsonObjectUtil.ObjectToJson(applicationVo);
        return applicationFeign.addWithdrawal(jsonObject,result);
    }
    @PostMapping("/getapplicationlist")
    public String getAppliCationList(ApplicationQueryVo queryVo){
        JSONObject jsonObject = JsonObjectUtil.ObjectToJson(queryVo);
        return applicationFeign.getAppliCationList(jsonObject);

    }
    @PostMapping("/addapplication")
    public String addApplication(ApplicationVo applicationVo, BindingResult result){
        JSONObject jsonObject = JsonObjectUtil.ObjectToJson(applicationVo);
        return applicationFeign.addApplication(jsonObject,result);
    }
}
